/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package MainClasses.EventListeners;

import MainClasses.*;
import MainClasses.Event.*;
import java.awt.Container;

import javax.swing.*;

/**
 *
 * @author andrewcutler
 */
public class CheckboxListener{

    public static void eventPopup(Event assign)
    {
        JFrame frame = main.getAssignmentFrame();
        if(frame != null)
        {
            frame.dispose();
        }
  
        frame = new JFrame(assign.getName());
        main.setAssignmentFrame(frame);

        Container content = frame.getContentPane();
        content.setLayout(new BoxLayout(content, BoxLayout.PAGE_AXIS));
        content.add(new JLabel("Title: " + assign.getName()));
        content.add(new JLabel("            "));
        if(assign instanceof SchoolEvent)
        {
            content.add(new JLabel("Class: " + ((SchoolEvent)assign).getCourse().getCourseName()));
            content.add(new JLabel("Teacher: " + ((SchoolEvent)assign).getCourse().getTeacher()));
        }
        content.add(new JLabel("Date Assigned: " + assign.getStartDate().toString(MyDate.FORMAT_1, "-")));
        content.add(new JLabel("Date Due: " + assign.getEndDate().toString(MyDate.FORMAT_1, "-")));

        JTextPane editPane = new JTextPane();
        editPane.setText(assign.getDescription());
        editPane.setEditable(false);
        content.add(editPane);            
        frame.pack();
        frame.setSize(400,400);
        frame.setVisible(true);
    }
}
